<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
				 java.util.ArrayList,
				 com.scalar.chiptrack.sales.SalesOrder,
				 com.scalar.chiptrack.utils.StringUtils,
				 com.scalar.chiptrack.alarms.AlarmUser,
				 java.util.Iterator,
				 com.scalar.chiptrack.sales.LineItem,
                 com.scalar.chiptrack.commons.Constants"%>
<%@ page import="com.scalar.chiptrack.alarms.Alarm"%>
<%@ page import="com.scalar.chiptrack.alarms.Comment"%>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TR>
        <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
        <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
            <BR><IMG src="<%=chipTracContext%>/jsp/includes/images/scalar_logo.jpg" width=180 height=72 border=0>
            <center>
                <span class="NArialW">Notification Information</span>&nbsp;&nbsp;&nbsp;&nbsp;
                <font class='NArialL'>[<a href="javascript:window.close();" onMouseOver="window.status='Close this window';return true">Close</a>]</font>
            </center>
            <table border='0' width='80%' align='center'>
                <tr><td><chiptrack:errors styleClass="NArialL" /></td></tr>
                <tr>
                    <td colspan='2' bgcolor='#993333' align='center'>
                        <font color='#FFFFFF'><font size='4'><strong>Notification Details</strong></font></font>
	                </td>
                </tr>
	            <tr bgcolor='#DEE1E2'  class="NArialL">
                    <td>Notification Name:</td>
                    <td>
                    <%
                        boolean sales_order_status = false;
                        Alarm alarm = ( Alarm ) request.getAttribute("alarm");
                    %>
                    <%= alarm.getName() %>
	                </td>
                </tr>
	            <tr bgcolor='#FFFFFF'  class="NArialL">
                    <td>Notification Type:</td>
                    <td><%=alarm.getType()%></td>
                 </tr>
	            <tr bgcolor='#DEE1E2' class="NArialL">
                    <td>Created By:</td>
                    <td><%=alarm.getOriginator().getName()%></td>
                </tr>
	            <tr bgcolor='#FFFFFF' class="NArialL">
                    <td>Created On:</td>
                    <td><%=StringUtils.formatDateToString(new java.util.Date (alarm.getCreatedOn()))%></td>
                </tr>
                <tr bgcolor='#DEE1E2' class="NArialL">
                    <td>Expires On:</td>
	                <%   if (alarm.getExpiresOn() == -1) {
	                %>	 <td>Never Expires</td></tr>
	                <%   } else { %>
		            <td><%=StringUtils.formatDateToString(new java.util.Date (alarm.getExpiresOn())) %></td>
                </tr>
	            <% } %>
	            <tr bgcolor='#FFFFFF'  class="NArialL">
                    <td>Priority:</td>
                    <td><%=alarm.getPriority()%></td>
                </tr>
	            <tr bgcolor='#DEE1E2' class="NArialL">
                    <td>Notification Current State:</td>
                    <td><%=alarm.getCurrentState()%></td>
                </tr>
	            <tr bgcolor='#FFFFFF' class="NArialL">
                    <td>Last Updated By:</td>
                    <td><%=alarm.getLastUpdatedBy()%></td>
                </tr>
                <%
                    String bgColor[] = {"#DEE1E2", "#FFFFFF"};
                    int i=0;
                    Iterator it = alarm.getRecipients();
                %>
	            <tr><td colspan='2'><br></td></tr>
	            <tr><td colspan='2' bgcolor='#993333' align='left'><font class="NArialL"><font color='#FFFFFF'>Responses:</font></font></td></tr>
	            <%
		            while( it.hasNext() ) {
	            %>
	            <tr bgcolor="<%=bgColor[i%2]%>">
                    <td  class="NArialL">
	                <%
		            AlarmUser au = ( AlarmUser ) it.next();
	                %>
	                <%=au.getName()%>:
                    </td>
                    <td  class="NArialL"><%=au.getResponse()%></td>
                </tr>
	            <% i++; } %>
	            <%
	                String commentString = null;
	                if ( ( alarm.getComments() != null ) && ( alarm.getComments().size() > 0 ) )
                    {
                %>
	            <tr><td colspan='2'><br></td></tr>
	            <%
		            com.scalar.chiptrack.alarms.Comment comment = null;
		            int size = alarm.getComments().size();
                %>
                <tr>
                    <td colspan='2'>
		                <table border='0' width='100%' align='center'>
			                <tr><td colspan='3' bgcolor='#993333' align='left'><font class="NArialL"><font color='#FFFFFF'>Comments:</font></font></td></tr>
		                <%
			                int color= 0;
			                for ( int x = 0; x < size; x++ )
                            {
			                    comment = ( Comment ) alarm.getComments().get(x);
			                    commentString = comment.getComment();
                                if ((commentString != null) && (commentString.trim().length() != 0))
                                {
		                %>
			            <tr bgcolor="<%=bgColor[color%2]%>">
                            <td width='15%'  class="NArialL"><%=comment.getCreatedBy()%> </td>
				            <td width='25%'  class="NArialL"><%=StringUtils.formatDateToString(new java.util.Date (comment.getCreatedOn()))%></td>
                            <td width='60%' class="NArialL"><%=comment.getComment()%></td>
			            </tr>
                		<%
                                    color++;
                                }
                            }
                        %>
		            </table>
                </td>
            </tr>
                <% } %>
    <%
        int isSample = 0;
        String heading = null;
        if( alarm.getType().equals( Constants.SAMPLE_ORDER_ALARM ) )
        {
            isSample = 0;
            heading = "Sample";
        }
        else if ( alarm.getType().equals( Constants.SALES_ORDER_ALARM ) )
        {
            isSample = 1;
            heading = "Sales";
        }
        SalesOrder salesOrder = ( SalesOrder ) request.getAttribute("salesOrder");
    %>
    <%
        if( salesOrder != null )
        {
    %>
            <tr><td colspan='2'><br></td></tr>
	        <tr><td colspan='2' bgcolor='#993333' align='center'><font  color='#FFFFFF' size='4'><strong><%=heading%> Order Detail</strong></font></td></tr>
            <tr><td colspan='5'>
        <table>
	        <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Created By:</td>
                <td class="NArialL" width='20%'><%=alarm.getOriginator().getName()%></td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Last Updated On:</td>
                <td class="NArialL" width='20%'><%=StringUtils.formatDateToString(new java.util.Date (alarm.getCreatedOn()))%></td>
            </tr>
   	        <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Sales Order No:</td>
                <td class="NArialL" width='20%'><%=salesOrder.getSalesOrderNo()%></td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Customer Name:</td>
                <td class="NArialL" width='20%'><%=salesOrder.getCustomerName()%></td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Change No:</td>
                <td class="NArialL" width='20%'><%=salesOrder.getChangeNumber()%></td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>&nbsp;</td>
                <td class="NArialL" width='20%'>&nbsp;</td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Customer PO:</td>
                <td class="NArialL" width='20%'><%=salesOrder.getCustomerPO()%></td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Contact Person:</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getContactPerson() != null ){ %>
                    <%=salesOrder.getContactPerson()%>
                    <% } %>
                </td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'><bean:message key="label.sales.salesOrder.PoRevisionNumber"/> :</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getPoRev() != null) { %>
                    <%=salesOrder.getPoRev()%>
                    <% } %>
                </td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'><bean:message key="label.sales.salesOrder.PoDate"/> :</td>
                <td class="NArialL" width='20%'>
                    <% if(salesOrder.getPoDate() != null) { %>
                    <%=salesOrder.getPoDate()%>
                    <% } %>
                </td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Quotation No:</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getQuotationNo() != null ) { %>
                    <%=salesOrder.getQuotationNo()%>
                    <% } %>
                </td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>&nbsp;</td>
                <td class="NArialL" width='20%'>&nbsp;</td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Phone:</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getPhoneNumber() != null ) { %>
                    <%=salesOrder.getPhoneNumber()%>
                    <% } %>
                </td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Cell:</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getCellNumber() != null ) { %>
                    <%=salesOrder.getCellNumber()%>
                    <% } %>
                </td>
            </tr>
            <tr>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Fax:</td>
                <td class="NArialL" width='20%'>
                    <% if(salesOrder.getFaxNumber() != null) { %>
                    <%=salesOrder.getFaxNumber()%>
                    <% } %>
                </td>
                <td width='30%'>&nbsp;</td>
                <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Email:</td>
                <td class="NArialL" width='20%'>
                    <% if( salesOrder.getEmail() != null ) { %>
                    <%=salesOrder.getEmail()%>
                    <% } %> </td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Sales Person:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getSalesPerson() != null ) { %>
                        <%=salesOrder.getSalesPerson()%>
                        <% } %>
                    </td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'><bean:message key="label.sales.salesRep.Name"/>:</td>
                    <td class="NArialL" width='20%'>
                        <% if(salesOrder.getSalesRep()!= null){%>
                        <%=salesOrder.getSalesRep()%>
                        <% } %>
                    </td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'> <bean:message key="label.sales.salesOrder.ShippingMethod" />:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getShippingMethod() != null ) { %>
                        <%=salesOrder.getShippingMethod()%>
                        <% } %>
                    </td>
                    <td width='30%'>&nbsp;</td>
                    <td bgcolor='#DEE1E2' class="NArialL" width='20%'>&nbsp;</td>
                    <td width='20%'>&nbsp;</td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Pay Terms:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getShippingTerms() != null) { %>
                        <%=salesOrder.getShippingTerms()%>
                        <% } %>
                    </td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Delivery Terms:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getDeliveryTerms() != null ) { %>
                        <%=salesOrder.getDeliveryTerms()%>
                        <% } %> </td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Regional Rep:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getRegionalRep() != null ){ %>
                        <%=salesOrder.getRegionalRep()%>
                        <% } %>
                    </td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Booking Date:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getSalesOrderDate() != null) { %>
                        <%=salesOrder.getSalesOrderDate()%>
                        <% } %>
                    </td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'><bean:message key="label.sales.endUser"/>:</td>
                    <td class="NArialL" width='20%'>
                        <% if( salesOrder.getEndCustomer() != null ) { %>
                        <%=salesOrder.getEndCustomer()%>
                        <% } %>
                    </td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'><bean:message key="label.sales.endCustomer"/>:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getOdm() != null){%>
                        <%=salesOrder.getOdm()%>
                        <%}%></td>
                    </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Billing Address:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getBillingAddress() != null){%>
                        <%=salesOrder.getBillingAddressAsHTML()%>
                        <%}%></td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Shipping Address:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getShippingAddress() != null){%>
                        <%=salesOrder.getShippingAddressAsHTML()%>
                        <%}%></td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Freight Instructions:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getFreightInstructions()!= null){%>
                        <%=salesOrder.getFreightInstructions()%>
                        <%}%></td>
                    <td width='30%'>&nbsp;</td>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Shipping Instructions:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getShippingInstructions() != null){%>
                        <%=salesOrder.getShippingInstructions()%>
                        <%}%></td>
                </tr>
                <tr>
                    <td  bgcolor='#DEE1E2' class="NArialL" width='20%'>Comments:</td>
                    <td class="NArialL" width='20%'><% if(salesOrder.getComments() != null){%>
                        <%=salesOrder.getComments()%>
                        <%}%></td>
                    <td width='30%'>&nbsp;</td>
                    <td bgcolor='#DEE1E2' class="NArialL" width='20%'>&nbsp;</td>
                    <td width='20%'>&nbsp;</td>
                </tr>
            </table>
            </td>
        </tr>
	    <!-- Cancelled Sales Orders -->
	    <%
            ArrayList cancelledList = ( ArrayList ) request.getAttribute("cancelledList");
	        if( cancelledList != null && cancelledList.size() > 0 )
            {
        %>
        <tr><td colspan='2'><br></td></tr>
        <tr><td colspan=6 class="NArialW"><font size='4'>Cancelled LineItems</font></td></tr>
        <tr>
            <td colspan=6>
		        <table border='0' width='100%' bordercolor='#FFFFFF'>
			        <tr>
                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>PO Line Item</font></font>
                        </td>

                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Line Item</font></font>
                        </td>
                        <td width='10%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'><bean:message key="label.mfgPartNumber" /></font></font>
                        </td>
                        <td width='1%' align=center bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'><bean:message key="label.customerPartNumber"/></font></font>
                        </td>
                        <td width='1%' align=center bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Taxable</font></font></td>
                        <td width='5%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Quantity</font></font>
                        </td>
                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Price </font></font>
                        </td>
                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF' >Amount</font></font>
                        </td>
                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Reqd Dock Date</font></font>
                        </td>
                        <td width='8%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF'>Schedule Date</font></font>
                        </td>
                        <td width='15%' align='center' bgcolor='#993333'>
                            <font class="NArialL"><font color='#FFFFFF' >Status</font></font>
                        </td>
			        </tr>
                    <%
                    for( int y = 0; y < cancelledList.size(); y++ )
			        {
			            LineItem lineitem = ( LineItem ) cancelledList.get( y );
			        %>
			        <tr>
                        <td width='8%' bgcolor='#DEE1E2' align=center class="NArialL">
					        <%=lineitem.getPoLineItemNo()%>
				        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem.getLineItemNo()%>
                        </td>
                        <td width='10%' bgcolor='#DEE1E2' class="NArialL">
                        <% if( lineitem.getManufacturingPartNo() != null) { %>
                            <%=lineitem.getManufacturingPartNo()%>
                        </td>
                        <% } else { %>
                        </td>
                        <% } %>
                        <td width='8%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem.getCustomerPartNo()%>
                        </td>
                        <td width='1%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem.getIsTaxableAsString()%>
                        </td>
                        <td width='5%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem.getQtyAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem.getUnitPriceAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem.getAmountAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' class="NArialL">
                            <%=lineitem.getRequestDate()%></td>
                        <td width='8%' bgcolor='#DEE1E2' class="NArialL">
                            <%=lineitem.getScheduleDate()%>
                        </td>
                        <td width='15%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem.getStatus()%>
                       </td>
                    </tr>
			    <% } %>
		        </table>
         <% } %>
		    </td>
        </tr>
        <!-- Changed Sales Orders -->
		<%
			ArrayList changedList = ( ArrayList ) request.getAttribute("changedList");
			if( changedList != null &&  changedList.size() > 0 )
            {
		%>
		<tr><td colspan='2'><br></td></tr>
	    <tr><td colspan=6 class="NArialW"><font size='4'>Changed LineItems</font></td></tr>
		<tr>
			<td colspan=6>
				<table border='0' width='100%' bordercolor='#FFFFFF'>
                    <tr>
						<td width='8%' align='center' bgcolor='#993333'>
							<font class="NArialL"><font color='#FFFFFF'>PO Line Item</font></font>
						</td>
						<td width='8%' align='center' bgcolor='#993333'>
							<font class="NArialL"><font color='#FFFFFF'>Line Item</font></font>
						</td>
						<td width='10%' align='center' bgcolor='#993333'>
							<font class="NArialL"><font color='#FFFFFF'><bean:message key="label.mfgPartNumber" /></font></font>
						</td>
						<td width='10%' align='center' bgcolor='#993333'>
							<font class="NArialL"><font color='#FFFFFF'><bean:message key="label.customerPartNumber"/></font></font>
						</td>
						<td width='5%' align=center bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Taxable</font></font></td>
						<td width='5%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Quantity</font></font></td>
						<td width='8%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Price </font></font></td>
						<td width='8%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Amount</font></font></td>
						<td width='8%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Reqd Dock Date</font></font></td>
						<td width='8%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Schedule Date</font></font></td>
						<td width='15%' align='center' bgcolor='#993333'><font class="NArialL"><font color='#FFFFFF'>Status</font></font></td>
					</tr>
					<%
                    for(int z=0;z<changedList.size();z++)
                    {
                       LineItem lineitem1 = (LineItem)changedList.get(z);%>
                    <tr>
                        <td width='8%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem1.getPoLineItemNo()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem1.getLineItemNo()%>
                        </td>
                        <td width='10%' bgcolor='#DEE1E2' class="NArialL">
                        <% if( lineitem1.getManufacturingPartNo() != null ) { %>
                            <%=lineitem1.getManufacturingPartNo()%>
                        </td>
                        <% } else { %>
                        </td>
                        <% } %>
                        <td width='10%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem1.getCustomerPartNo()%>
                        </td>
                        <td width='5%' bgcolor='#DEE1E2' align=center class="NArialL">
                            <%=lineitem1.getIsTaxableAsString()%>
                        </td>
                        <td width='5%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem1.getQtyAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem1.getUnitPriceAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                            <%=lineitem1.getAmountAsString()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                           <%=lineitem1.getRequestDate()%>
                        </td>
                        <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
                           <%=lineitem1.getScheduleDate()%>
                        </td>
                        <td width='15%' bgcolor='#DEE1E2' align=center class="NArialL">
                           <%=lineitem1.getStatus()%>
                        </td>
                    </tr>
			        <% } %>
                </table>
            </td>
        </tr>
        <%  } %>
        <!-- Present Line items  -->
		<%
            ArrayList presentList = ( ArrayList ) request.getAttribute("presentList");
			if( presentList != null &&  presentList.size() > 0 )
			{
		%>
		<tr><td colspan='2'><br></td></tr>
		<tr><td colspan=6 class="NArialW"><font size='4'>Present LineItems</font></td></tr>
		<tr><td colspan=44>
			<table border='0' width='100%' bordercolor='#FFFFFF'>
				<tr>
					<td width='9%' align=left bgcolor='#993333'>
					    <font class="NArialL"><font color='#FFFFFF'>PO Line Item</font></font>
                    </td>
                    <td width='9%' align=left bgcolor='#993333'>
					    <font class="NArialL"><font color='#FFFFFF'>Line Item</font></font>
                    </td>
					<td width='15%' align=center bgcolor='#993333'>
				        <font class="NArialL"><font color='#FFFFFF'><bean:message key="label.mfgPartNumber" /></font></font></td>
                    <td width='10%' align=center bgcolor='#993333'>
					    <font class="NArialL"><font color='#FFFFFF'><bean:message key="label.customerPartNumber"/></font></font>
                    </td>
				    <td width='10%' align=center bgcolor='#993333'>
			   	        <font class="NArialL"><font color='#FFFFFF'>Description</font></font></td>
				    <td width='5%' align=center bgcolor='#993333'>
					    <font class="NArialL"><font color='#FFFFFF'>Taxable</font></font>
                    </td>
				    <td width='5%' align=center bgcolor='#993333'>
				        <font class="NArialL"><font color='#FFFFFF'>Quantity</font></font>
                     </td>
                    <td width='8%' align=center bgcolor='#993333'>
	 			        <font class="NArialL"><font color='#FFFFFF'>Price </font></font>
                    </td>
				    <td width='8%' align=center bgcolor='#993333'>
						<font class="NArialL"><font color='#FFFFFF'>Amount</font></font>
					</td>
				    <td width='8%' align=center bgcolor='#993333'>
						<font class="NArialL"><font color='#FFFFFF'>Reqd Dock Date</font></font>
					</td>
				    <td width='8%' align=center bgcolor='#993333'>
						<font class="NArialL"><font color='#FFFFFF'>Schedule Date</font></font>
					</td>
                    <td width='8%' align=center bgcolor='#993333'>
						<font class="NArialL"><font color='#FFFFFF'>Revised Ship Date</font></font>
					</td>
					<td width='20%' bgcolor='#993333'>
						<table width='100%' border='0'  bordercolor='#FFFFFF'>
							<tr><td colspan=4  align=center><font class="NArialL"><font color='#FFFFFF'>Holds</font></font></td></tr>
							<tr>
								<td width='25%' align=left><font class="NArialL"><font color='#FFFFFF'>Mktg</font></font></td>
								<td width='25%' align=center ><font class="NArialL"><font color='#FFFFFF'>Fin</font></font></td>
								<td width='25%' align=center ><font class="NArialL"><font color='#FFFFFF'>Ops</FONT></font></td>
								<td align=right width='25%' ><font class="NArialL"><font color='#FFFFFF'>Sales</FONT></font></td>
							</tr>
						</table>
					</td>
                    <td width='8%' align=center bgcolor='#993333' align="center">
					    <font class="NArialL"><font color='#FFFFFF'>Expedite Fee</font></font>
                    </td>
					<td width='8%' align=center bgcolor='#993333'>
					    <font class="NArialL"><font color='#FFFFFF'>Status</font></font>
                    </td>
				</tr>
				<%
					for(int p = 0; p < presentList.size(); p++ )
					{
						LineItem lineitem2 = (LineItem)presentList.get(p);
				%>
				<tr>
					<td width='10%' bgcolor='#DEE1E2' align=center class="NArialL">
						<%=lineitem2.getPoLineItemNo()%>
					</td>
					<td width='10%' bgcolor='#DEE1E2' align=center class="NArialL">
						<%=lineitem2.getLineItemNo()%>
					</td>
					<td width='15%' bgcolor='#DEE1E2' class="NArialL">
				<%
					if( lineitem2.getManufacturingPartNo() != null && !lineitem2.getManufacturingPartNo().equals( "null" ) ) {
				%>
					   <%=lineitem2.getManufacturingPartNo()%>
					</td>
				<% } else { %>
					</td>
				<% } %>
					<td width='10%' bgcolor='#DEE1E2'  align=center class="NArialL">
						<%=lineitem2.getCustomerPartNo()%>
					</td>
					<td width='10%' bgcolor='#DEE1E2' class="NArialL">
					<% if( lineitem2.getLineItemDescription() != null) { %>
					<%= lineitem2.getLineItemDescription()%>
					</td>
					<% } else { %>
					</td>
					<% } %>
					<td width='5%' bgcolor='#DEE1E2'  align=center class="NArialL">
						<%=lineitem2.getIsTaxableAsString()%>
					</td>
					<td width='5%' bgcolor='#DEE1E2' align=right class="NArialL">
						<%=lineitem2.getQtyAsString()%>
					</td>
					<td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
						<%=lineitem2.getUnitPriceAsString()%>
					</td>
				    <td width='8%' bgcolor='#DEE1E2' align=right class="NArialL">
						<%=lineitem2.getAmountAsString()%>
					</td>
				    <td width='8%' bgcolor='#DEE1E2' class="NArialL">
						<%=lineitem2.getRequestDate()%>
					</td>
				    <td width='8%' bgcolor='#DEE1E2' class="NArialL">
						<%=lineitem2.getScheduleDate()%>
					</td>
                    <td width='8%' bgcolor='#DEE1E2' class="NArialL">
                        <%=((lineitem2.getRevisedDate() == null) ? "" : lineitem2.getRevisedDate())%>
					</td>
				    <td width='20%' bgcolor='#DEE1E2' class="NArialL">
						<table width='100%'>
							<tr>
								<td  width='25%' align=center class="NArialL">
								<% if(lineitem2.getMarketingHold().equals("0")) { %>
									X
								<%} else { %>
									<%=lineitem2.getMarketingHold()%>
								<% } %>
								</td>
								<td  width='25%' align=center class="NArialL" >
								<% if(lineitem2.getFinanceHold().equals("0")) { %>
									X
								<%} else { %>
									<%=lineitem2.getFinanceHold()%>
								<%}%>
								</td>
								<td  width='25%' align=center  class="NArialL">
								<% if(lineitem2.getOperationsHold().equals("0")) { %>
									X
								<%} else { %>
									<%=lineitem2.getOperationsHold()%>
								<%}%>
								</td>
								<td   width='25%' align=center class="NArialL">
								<% if(lineitem2.getSalesHold().equals("0")) { %>
									X
								<%} else { %>
									<%=lineitem2.getSalesHold()%>
								<%}%>
								</td>
							</tr>
						</table>
					</td>
                    <td width='8%' bgcolor='#DEE1E2' class="NArialL">
						<%=lineitem2.getIsExpedite() ? "Yes":"No"%>
					</td>
					<td width='8%' bgcolor='#DEE1E2' class="NArialL">
						<%=lineitem2.getStatus()%>
					</td>
			    </tr>
		        <%
				        if( lineitem2.getStatus().equals("HOLD") || lineitem2.getStatus().equals("PENDING") || lineitem2.getStatus().equals("Cancellation needs approval") )
                        {
				            sales_order_status=true;
				        }
		            }
                %>
  				<tr>
					<td colspan=6  align='center'></td>
					<td  align='right'  class="NArialL" nowrap>Sub Total</td>
					<td bgcolor='#DEE1E2'  align='right' class="NArialL"><%=salesOrder.getSubTotalAsString()%></td>
			    </tr>
			    <tr>
					<td colspan=7 align=right class="NArialL" >Sales Tax</td>
					<td bgcolor='#DEE1E2'  align='right' class="NArialL"><%=salesOrder.getSalesTaxAsString()%></td>
                </tr>
			    <tr>
					<td colspan=7 align=right class="NArialL" >Freight</td>
					<td bgcolor='#DEE1E2'  align='right' class="NArialL"><%=salesOrder.getFrieghtAsString()%></td>
			    </tr>
			    <tr>
				    <td colspan=7 align=right class="NArialL" >
					   <%=salesOrder.getMiscName()%>
					</td>
					<td bgcolor='#DEE1E2'  align='right' class="NArialL"><%=salesOrder.getMiscAsString()%></td>
			    </tr>
			    <tr>
				    <td colspan=7 align=right  class="NArialL">Order Total</td>
					<td bgcolor='#DEE1E2'  align='right' class="NArialL"><%=salesOrder.getOrderTotalAsString()%></td>
			    </tr>
            </table>
		<%
            }
        }
        %>
		<tr><td colspan='2'><br></td></tr>
		<tr bgcolor='#DEE1E2'>
            <td colspan='2' class="NArialL">Message from Originator: <br>
		<%
        java.lang.String str = null;

        if(sales_order_status)
        {
            str = chipTracContext+"/approveOrder.do?salesOrderId="+salesOrder.getSalesOrderId()+"&isSample="+isSample;
        }
        else
        {
            str = chipTracContext+"/order.do?salesOrderId="+salesOrder.getSalesOrderId()+"&isSample="+isSample;
        }
		%>
		    Please Click<a href='<%=str%>'>here</a> to Approve/View this order
		    </td>
        </tr>
    </table>
    </TD>
    <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
    </TR>
</TABLE>
<script language="javascript">
function windowOpen()
{
    var str = '<%=str%>'
    var newWindow
	newWindow = window.open (str,'optionsPopup1','directories=yes,toolbar=yes,menubar=yes,personalbar=no,location=yes,status=yes,scrollbars=yes,resizable=yes');
	newWindow.focus();
}
</script
</body>
</html>
